import { Navigate } from "react-router-dom"
import { lazy, Suspense } from "react"

var FnSuspense = ({ children }: any) => {
    return <Suspense fallback={<div className='loading'>loading......</div>}>
        {children}
    </Suspense>
}

//导入一级路由
var Index = lazy(() => import('../views/Index'))
var Login = lazy(() => import('../views/Login'))
var NotFound = lazy(() => import('../views/NouFound'))

//导入二级路由
//工作台
var Staging = lazy(() => import('../views/Index/Staging'))//工作台
//内容管理  Content
var Advertising = lazy(() => import('../views/Index/Content/Advertising'))//广告位
var Hot = lazy(() => import('../views/Index/Content/Hot'))//热搜
var Evaluate = lazy(() => import('../views/Index/Content/Evaluate'))//评价管理
var Cjh = lazy(() => import('../views/Index/Content/Cjh'))//cjh
//商品管理  Commodity
var Manage = lazy(() => import('../views/Index/Commodity/Manage/index'))//商品管理
var Grouping = lazy(() => import('../views/Index/Commodity/Grouping'))//分组
var Brand = lazy(() => import('../views/Index/Commodity/Brand'))//品牌
var Label = lazy(() => import('../views/Index/Commodity/Label'))//标签
var Attribute = lazy(() => import('../views/Index/Commodity/Attribute'))//商品属性
//客户管理  Custom
var Query = lazy(() => import('../views/Index/Custom/Query/index'))//查询
var Customersegmentation = lazy(() => import('../views/Index/Custom/Customersegmentation'))//客户分群
var Member = lazy(() => import('../views/Index/Custom/Member'))//会员
var Equity = lazy(() => import('../views/Index/Custom/Equity'))//权益
var Integral = lazy(() => import('../views/Index/Custom/Integral'))//积分
var Admin = lazy(() => import('../views/Index/Custom/Query/AdminParticulars'))

//营销活动  Activity
var Scene = lazy(() => import('../views/Index/Activity/Scene'))//查询
var Operate = lazy(() => import('../views/Index/Activity/Operate'))//客户分群
var Coupon = lazy(() => import('../views/Index/Activity/Coupon'))//会员
var Piecing = lazy(() => import('../views/Index/Activity/Piecing'))//权益
var Seckill = lazy(() => import('../views/Index/Activity/Seckill'))//积分
var Operateshuju = lazy(() => import('../views/Index/Activity/xlq/Operateshuju'))
var Couponshuju = lazy(() => import('../views/Index/Activity/xlq/Couponshuju'))

export default [
    {
        path: '/index',
        element: <Index />,
        children: [
            {
                path: '/index/staging',
                element: <FnSuspense><Staging /></FnSuspense>
            },
            {
                path: '/index/Advertising',
                element: <FnSuspense><Advertising /></FnSuspense>
            },
            {
                path: '/index/Hot',
                element: <FnSuspense><Hot /></FnSuspense>
            },
            {
                path: '/index/Cjh',
                element: <FnSuspense><Cjh /></FnSuspense>
            },
            {
                path: '/index/Evaluate',
                element: <FnSuspense><Evaluate /></FnSuspense>
            },
            {
                path: '/index/Manage',
                element: <FnSuspense><Manage /></FnSuspense>
            },
            {
                path: '/index/Grouping',
                element: <FnSuspense><Grouping /></FnSuspense>
            },
            {
                path: '/index/Brand',
                element: <FnSuspense><Brand /></FnSuspense>
            },
            {
                path: '/index/Label',
                element: <FnSuspense><Label /></FnSuspense>
            },
            {
                path: '/index/Attribute',
                element: <FnSuspense><Attribute /></FnSuspense>
            },
            {
                path: '/index/Query',
                element: <FnSuspense><Query /></FnSuspense>,
                // children: [
                //     {
                //         path: '/index/Query/admin',
                //         element: <FnSuspense><Admin /></FnSuspense>
                //     },
                //     {
                //         path: '*',
                //         element: <NotFound />
                //     }
                // ]
            },
            {
                path: '/index/Query/admin',
                element: <FnSuspense><Admin /></FnSuspense>
            },
            {
                path: '/index/Customersegmentation',
                element: <FnSuspense><Customersegmentation /></FnSuspense>
            },
            {
                path: '/index/Member',
                element: <FnSuspense><Member /></FnSuspense>
            },
            {
                path: '/index/Equity',
                element: <FnSuspense><Equity /></FnSuspense>
            },
            {
                path: '/index/Integral',
                element: <FnSuspense><Integral /></FnSuspense>
            },
            {
                path: '/index/Scene',
                element: <FnSuspense><Scene /></FnSuspense>
            },
            {
                path: '/index/Operate',
                element: <FnSuspense><Operate /></FnSuspense>
            },
            {
                path: '/index/Coupon',
                element: <FnSuspense><Coupon /></FnSuspense>
            },
            {
                path: '/index/Piecing',
                element: <FnSuspense><Piecing /></FnSuspense>
            },
            {
                path: '/index/Seckill',
                element: <FnSuspense><Seckill /></FnSuspense>
            },
            {
                path: '/index/Operateshuju',
                element: <FnSuspense><Operateshuju /></FnSuspense>
            },
            {
                path: '/index/couponshuju',
                element: <FnSuspense><Couponshuju /></FnSuspense>
            },
            {
                path: '/index',
                element: <Navigate to='/index/staging' />
            },
            {
                path: '*',
                element: <NotFound />
            }
        ]
    },
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/',
        element: <Navigate to='/index' />
    },
    {
        path: '*',
        element: <NotFound />
    }
]

